<html>
<head>
    <style type="text/css">
        #overlay{
            position:absolute;
            width:100%;
            height:100%;
            background:#630;
            opacity: 0.1;
            display:none;
        }
        #win{
            position:absolute;
            background:#fff;
            border:1px solid #f90;
            display:none;
            z-index: 6;
            width: 30px;
            height: 20px;
        }

    </style>
    <script src="//cdn.bootcss.com/jquery/1.11.0-rc1/jquery.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#addnew").css({
                "cursor": "pointer"  //就让不是超链接的，当鼠标放上去后也会成小手
            });
            $("#close").click(function () {
                $("html").css({
                    "overflow": "auto"  //让滚动条显示
                });
                $("#overlay").css({
                    "display": "none"
                });
                $("#win").css({
                    "display": "none"
                });
            });
            $("#detenew").click(function(){
                $("#overlay").css({
                    "display": "none",

                });
            });
            $("#addnew").click(function () {
                var y = document.documentElement.scrollTop;  //不懂的话，可以看看我上一篇博文
                var x = document.documentElement.scrollLeft;
                var px = document.body.clientWidth;
                var py = document.body.clientHeight;
                $("html").css({
                    "height": "100%",
                    "overflow": "hidden"   //让滚动条消失
                });
                $("#overlay").css({
                    "display": "block",
                    "top": y,
                    "left": x
                });
                $("#win").css({
                    "display": "block",
                    "top": parseInt(y) + parseInt(py) / 2,  //parseInt()把数值类型转换为Int类型
                    "left": parseInt(x) + parseInt(px) / 2
                });
            });
        })
    </script>
</head>
<body>
<div id="overlay">
</div>
<div id="win"><button id="detenew">解锁</button></h2>
</div>
<button id="addnew">锁定</button>6666
</body>